/*
    BibleNotebook - A bible reader software
    Copyright (C) 2014  Williams Fernando Lopez

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
 */

package com.simplebible.bible.objects;


import java.util.List;

/**
 *
 * @author Williams Lopez
 */
public class Verse extends BibleObject{
    private String text;
    private List<Referencia> refCruzadas;

    public String getText() {
        return text;
    }



    public String getTextWithoutMarks(){
        if(text!=null){
            text = text.replaceAll("[#][#][0-9]+", "");
            text = text.replaceAll("[#][0-9]+", "");
        }
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }



    @Override
    public String toString() {
        return this.getHumanName() +" "+ text;
    }

    public List<Referencia> getRefCruzadas() {
        return refCruzadas;
    }

    public void setRefCruzadas(List<Referencia> refCruzadas) {
        this.refCruzadas = refCruzadas;
    }

    @Override
    public String getHumanName() {
        StringBuilder sb = new StringBuilder(this.getAbreviation().getVerse());
        List<Abreviation> ad = this.getAbreviation().getAditionalReferences();
        if (ad != null && !ad.isEmpty()) {
            for (int i = 0; i < ad.size(); i++) {
                Abreviation a = ad.get(i);
                if (i == (ad.size() - 1)) {
                    sb.append(" y ");
                } else {
                    sb.append(", ");
                }
                sb.append(a.getVerse());

            }
        }

        return super.getHumanName();
    }

    

}
